import React, {Component} from 'react';
import {Image,TouchableOpacity,StyleSheet} from 'react-native';
import {scaleSize} from '../../../utils/screen';
import FontText from '../FontText';
import Column from './Column';
export default class Row extends Component {
    render() {
        let {fontstyle = {},data = {},renderStyle,style,columnStyle,dataKeys = []} = this.props;
        if(dataKeys.length == 0){
            dataKeys = Object.keys(data);
        }
        return (
            <TouchableOpacity 
                activeOpacity = {0.8}
                onPress = {()=>this.onPress()}
                style = {[styles.box,style]}>
                {
                    dataKeys.map((mkey,indexc)=>{
                        return <Column 
                            key = {`evalj_${indexc}`}
                            renderStyle = {renderStyle}
                            columnStyle = {columnStyle}
                            fontstyle = {fontstyle} 
                            mkey = {mkey}
                            text = {data[mkey]} />
                    })
                }
            </TouchableOpacity>
        )
    }
    onPress(){
        let {onPress} = this.props;
        onPress && onPress();
    }
    onRowPress(){
        let {onRowPress} = this.props;
        onRowPress && onRowPress();
    }
}

const styles = StyleSheet.create({
    box:{
        flexDirection: 'row',
        alignItems: 'center',
        flex:1,
        justifyContent: 'space-between',
    }
})